﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ChangeWifiWebApi
{
  public class VirtualRouterAccessor : IVirtualRouter
  { 
    private VirtualRouterHost.VirtualRouterHost _VirtualRouterHost;

    public void Start(string ssID, string ssPwd)
    {
      _VirtualRouterHost = new VirtualRouterHost.VirtualRouterHost();

      _VirtualRouterHost.SetConnectionSettings(ssID, 100);
      _VirtualRouterHost.SetPassword(ssPwd);

      var conns = _VirtualRouterHost.GetSharableConnections();
      var connToShare = conns.FirstOrDefault();
      _VirtualRouterHost.Start(connToShare);
    }

    public void Stop()
    {
      _VirtualRouterHost?.Stop();
    }
  }
}
